<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-json-lib.asp"-->

<%
'数据要求格式：
'[{"goods_name":"文具名1","goods_stock":20,"goods_unitprice":20},{"goods_name":"文具名2","goods_stock":20,"goods_unitprice":20}]
Response.ContentType = "application/json"
dim json,rs,sql
set json=jsArray()
' set json(Null) = jsObject()
goods_class=request("goods_class")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from goods_all where goods_class="&goods_class&" and goods_stock>0 order by goods_name,goods_purchase"
rs.Open sql,conn,1,1
do while not rs.eof
  set json(Null) = jsObject()
  json(Null)("goods_id")=rs("goods_id")
  json(Null)("goods_name")=rs("goods_name")
  json(Null)("goods_purchase")=rs("goods_purchase")
  json(Null)("goods_stock")=rs("goods_stock")
  json(Null)("goods_unitprice")=FormatCurrency(rs("goods_unitprice"),-1,-1)
  json(Null)("goods_model")=rs("goods_model")
  json(Null)("goods_spec")=rs("goods_spec")
  json(Null)("goods_memo")=rs("goods_memo")
  json(Null)("unit_name")=rs("unit_name")
  json(Null)("brand_name")=rs("brand_name")
  rs.movenext
loop
rs.close
set rs=nothing
json.Flush
%>
<!--#include file="lib/connclose.asp"-->